magiclanternfandomcom-20200223-history
Magic Lantern Development on Mac
General Notes I (coutts) installed this on my 2009 unibody Macbook Pro, running Snow Leopard 10.6.7. This page will help anybody set everything up from scratch. I will first cover how to install the ARM toolchain (to compile magic lantern), and then explain how to setup the arm console for firmware analysis. Related Links: GPL_Tools GPL Tools/ARM console GPL Tools/ARM console/API Installing Developer Tools You need to install Xcode so that you will have a compiler, it is not installed by default. It is easy to install though. If you have a snow leopard disk, there will be an installer for Xcode under the Optional Installs folder. If you do not have a snow leopard cd, you can still download Xcode from Apple's website for free. Just follow this link here to download Xcode 3. Once this is all done, you are ready to install the arm-toolchain. ARM Toolchain Setup The easiest route to go by far is Yagarto. It's an easy installer that takes 10 seconds to do. There's no waiting for things to download and compile, it's already done. First, download yagarto from that link above. Then, open readme and follow it word for word. it's fool proof, they explain everything there as far as setting up the toolchain in your .bash_profile and making sure things are working. Test that the path variable is working by running: arm-none-eabi-gcc --version You should see this as the result: Setting up MacHg Now that the compiler and arm-toolchain are all setup and working, it's time to download the magic lantern code and try to compile it. I like to use a program called MacHg, which you can download for free here. After the download is complete and you've installed it (move it to Applications), open it so we can setup the magic lantern repository. To pull from my repository with experimental daily builds, use this url: https://bitbucket.org/coutts/magic-lantern-500d The code will be cloned to your computer at a spot you choose. Editing the Makefile Before we can compile we must edit the make file to point at our binaries in the correct locations. The make file on my repository currently is setup from me compiling on my macbook, so all you will need to change is a couple words. You can find a copy of my Makefile here. Edit this part of the make file to match your paths and you will be all set to compile. ARM_PATH=~/yagarto/yagarto-4.6.0 ARM_BINPATH=$(ARM_PATH)/bin GCC_VERSION=4.6.0 CC=$(ARM_BINPATH)/arm-none-eabi-gcc-4.6.0 OBJCOPY=$(ARM_BINPATH)/arm-none-eabi-objcopy AR=$(ARM_BINPATH)/arm-none-eabi-ar RANLIB=$(ARM_BINPATH)/arm-none-eabi-ranlib LD=$(CC) HOST_CC=gcc HOST_CFLAGS=-O3 -W -Wall Compiling Magic Lantern Now that everything is all setup, it's time to see if it compiles. Open up a terminal and cd to the directory you have the repository at on your computer. Then, run: make clean followed by make It should go through and compile everything (it will take a minute or two depending on your computer). There will be lots of errors, don't worry, it's fine. If you get an error, look back and see where the first error occured at, it will tell you the file to check and the line number the problem is at. It should compile fine, but if you have any odd issues just email me and I'll help to resolve them. This will be the output if everything went well (along with a new Autoexec.bin file!!): So that covers setting up the compiler and arm-toolchain, and compiling magic lantern. Now, if you choose to, you can setup the arm-console for firmware analysis (lots of cool scripts thanks to A1ex). Setting up the ARM-console Ah.. now the fun part, and the part that will take the longest. Set aside a good 3-4 hours for this to finish. Follow these steps and you'll be using the console in no time. Setting up MacPorts This is what we will use to install the many components we need. Think of it as an equivilant of apt-get for mac. You can download MacPorts here. Setup is easy, just follow the installer. After the installation is complete, be sure to update MacPorts with the following commands (before installing anything always run this): sudo port selfupdate sudo port upgrade installed Once this is done, it's time to start installing what we need. Prerequisites Run the following commands, they will take a while dependning on how many dependencies are being installed too. Just wait it out and be patient, it could take several hours. sudo port install python27 sudo port select python python27 sudo port install py27-wxpython py27-numpy py27-matplotlib sudo port install py27-scipy py27-ipython